//
//  Info4CollectionViewCell.m
//  markmap
//
//  Created by 甘世清 on 2024/4/25.
//

#import "Info4CollectionViewCell.h"

@implementation Info4CollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.masksToBounds = YES;
        [self SQ_UIViewForSelfView];
    }
    return self;
}
/// 添加ui
-(void)SQ_UIViewForSelfView
{
    self.contentView.layer.cornerRadius = 10;
    self.contentView.clipsToBounds = YES;
    self.contentView.layer.masksToBounds = YES;
    self.contentView.layer.borderWidth = 1;
    self.contentView.layer.borderColor = UIColor.whiteColor.CGColor;
    [self.contentView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(4, 4, 4, 4));
    }];
    
}
- (void)setModel:(InfoModel *)model{
    self.messageLabel.text = model.name;
    if (model.isSeleted) {
        self.messageLabel.textColor = UIColor.whiteColor;
        self.contentView.layer.borderColor = UIColor.whiteColor.CGColor;
    } else {
        self.messageLabel.textColor = SQColor999999;
        self.contentView.layer.borderColor = SQColor999999.CGColor;
    }
}
- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_REGULAR(14);
        _messageLabel.numberOfLines = 0;
        _messageLabel.textAlignment = NSTextAlignmentCenter;
        _messageLabel.textColor = UIColor.whiteColor;
    }
    return _messageLabel;
}
@end
